package com.ytf.test.third;

/**
 * @author: YTF
 * @date: 2024/9/13 16:02
 * @version: 1.0
 * @description: 三元操作符
 */
public class TernaryIfElse {
    static int ternary(int i){
        return i<10?i*100:i*10;
    }
    static int standardIfElse(int i){
        if (i<10){
            i*=100;
        }else{
            i*=10;
        }
        return i;
    }
    public static void main(String[] args) {
        System.out.println(ternary(9));
        System.out.println(ternary(10));
        System.out.println(standardIfElse(9));
        System.out.println(standardIfElse(10));
        /**
         * Output:
         * 900
         * 100
         * 900
         * 100
         * 总结：
         *  没区别根据需要自己判断
         */
    }
}
